from django.http import HttpResponse
from django.template import Context, loader
from django.shortcuts import get_object_or_404, render_to_response

import ystockquote

def index(request):
    t = loader.get_template('quotelookup.html')
    c = Context()
    return HttpResponse(t.render(c))

def lookup(request):
    ticker = request.POST['ticker']
    t = loader.get_template('quote.html')
    c = Context({
        'ticker': ticker,
        'price': ystockquote.get_price(ticker),
        'all': ystockquote.get_all(ticker)
    })
    return HttpResponse(t.render(c))
